3.9 \(\int x (a+b \tan (c+d x^2))^2 \, dx\)

Optimal. Leaf size=51 \[ \frac{1}{2} x^2 \left (a^2-b^2\right )-\frac{a b \log \left (\cos \left (c+d x^2\right )\right )}{d}+\frac{b^2 \tan \left (c+d x^2\right )}{2 d} \]

[Out]

((a^2 - b^2)*x^2)/2 - (a*b*Log[Cos[c + d*x^2]])/d + (b^2*Tan[c + d*x^2])/(2*d)

________________________________________________________________________________________

Rubi [A]  time = 0.0470521, antiderivative size = 51, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 16, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.188, Rules used = {3747, 3477, 3475} \[ \frac{1}{2} x^2 \left (a^2-b^2\right )-\frac{a b \log \left (\cos \left (c+d x^2\right )\right )}{d}+\frac{b^2 \tan \left (c+d x^2\right )}{2 d} \]

Antiderivative was successfully verified.

[In]

Int[x*(a + b*Tan[c + d*x^2])^2,x]

[Out]

((a^2 - b^2)*x^2)/2 - (a*b*Log[Cos[c + d*x^2]])/d + (b^2*Tan[c + d*x^2])/(2*d)

Rule 3747

Int[(x_)^(m_.)*((a_.) + (b_.)*Tan[(c_.) + (d_.)*(x_)^(n_)])^(p_.), x_Symbol] :> Dist[1/n, Subst[Int[x^(Simplif
y[(m + 1)/n] - 1)*(a + b*Tan[c + d*x])^p, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p}, x] && IGtQ[Simplify[
(m + 1)/n], 0] && IntegerQ[p]

Rule 3477

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^2, x_Symbol] :> Simp[(a^2 - b^2)*x, x] + (Dist[2*a*b, Int[Tan[c + d
*x], x], x] + Simp[(b^2*Tan[c + d*x])/d, x]) /; FreeQ[{a, b, c, d}, x]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int x \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx &=\frac{1}{2} \operatorname{Subst}\left (\int (a+b \tan (c+d x))^2 \, dx,x,x^2\right )\\ &=\frac{1}{2} \left (a^2-b^2\right ) x^2+\frac{b^2 \tan \left (c+d x^2\right )}{2 d}+(a b) \operatorname{Subst}\left (\int \tan (c+d x) \, dx,x,x^2\right )\\ &=\frac{1}{2} \left (a^2-b^2\right ) x^2-\frac{a b \log \left (\cos \left (c+d x^2\right )\right )}{d}+\frac{b^2 \tan \left (c+d x^2\right )}{2 d}\\ \end{align*}

Mathematica [C]  time = 0.175392, size = 75, normalized size = 1.47 \[ \frac{2 b^2 \tan \left (c+d x^2\right )-i \left ((a+i b)^2 \log \left (-\tan \left (c+d x^2\right )+i\right )-(a-i b)^2 \log \left (\tan \left (c+d x^2\right )+i\right )\right )}{4 d} \]

Antiderivative was successfully verified.

[In]

Integrate[x*(a + b*Tan[c + d*x^2])^2,x]

[Out]

((-I)*((a + I*b)^2*Log[I - Tan[c + d*x^2]] - (a - I*b)^2*Log[I + Tan[c + d*x^2]]) + 2*b^2*Tan[c + d*x^2])/(4*d
)

________________________________________________________________________________________

Maple [A]  time = 0.005, size = 72, normalized size = 1.4 \begin{align*}{\frac{{b}^{2}\tan \left ( d{x}^{2}+c \right ) }{2\,d}}+{\frac{ab\ln \left ( 1+ \left ( \tan \left ( d{x}^{2}+c \right ) \right ) ^{2} \right ) }{2\,d}}+{\frac{\arctan \left ( \tan \left ( d{x}^{2}+c \right ) \right ){a}^{2}}{2\,d}}-{\frac{\arctan \left ( \tan \left ( d{x}^{2}+c \right ) \right ){b}^{2}}{2\,d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*(a+b*tan(d*x^2+c))^2,x)

[Out]

1/2*b^2*tan(d*x^2+c)/d+1/2/d*a*b*ln(1+tan(d*x^2+c)^2)+1/2/d*arctan(tan(d*x^2+c))*a^2-1/2/d*arctan(tan(d*x^2+c)
)*b^2

________________________________________________________________________________________

Maxima [B]  time = 1.03116, size = 201, normalized size = 3.94 \begin{align*} \frac{1}{2} \, a^{2} x^{2} - \frac{{\left (d x^{2} \cos \left (2 \, d x^{2} + 2 \, c\right )^{2} + d x^{2} \sin \left (2 \, d x^{2} + 2 \, c\right )^{2} + 2 \, d x^{2} \cos \left (2 \, d x^{2} + 2 \, c\right ) + d x^{2} - 2 \, \sin \left (2 \, d x^{2} + 2 \, c\right )\right )} b^{2}}{2 \,{\left (d \cos \left (2 \, d x^{2} + 2 \, c\right )^{2} + d \sin \left (2 \, d x^{2} + 2 \, c\right )^{2} + 2 \, d \cos \left (2 \, d x^{2} + 2 \, c\right ) + d\right )}} + \frac{a b \log \left (\sec \left (d x^{2} + c\right )\right )}{d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*(a+b*tan(d*x^2+c))^2,x, algorithm="maxima")

[Out]

1/2*a^2*x^2 - 1/2*(d*x^2*cos(2*d*x^2 + 2*c)^2 + d*x^2*sin(2*d*x^2 + 2*c)^2 + 2*d*x^2*cos(2*d*x^2 + 2*c) + d*x^
2 - 2*sin(2*d*x^2 + 2*c))*b^2/(d*cos(2*d*x^2 + 2*c)^2 + d*sin(2*d*x^2 + 2*c)^2 + 2*d*cos(2*d*x^2 + 2*c) + d) +
 a*b*log(sec(d*x^2 + c))/d

________________________________________________________________________________________

Fricas [A]  time = 1.62378, size = 113, normalized size = 2.22 \begin{align*} \frac{{\left (a^{2} - b^{2}\right )} d x^{2} - a b \log \left (\frac{1}{\tan \left (d x^{2} + c\right )^{2} + 1}\right ) + b^{2} \tan \left (d x^{2} + c\right )}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*(a+b*tan(d*x^2+c))^2,x, algorithm="fricas")

[Out]

1/2*((a^2 - b^2)*d*x^2 - a*b*log(1/(tan(d*x^2 + c)^2 + 1)) + b^2*tan(d*x^2 + c))/d

________________________________________________________________________________________

Sympy [A]  time = 0.436217, size = 65, normalized size = 1.27 \begin{align*} \begin{cases} \frac{a^{2} x^{2}}{2} + \frac{a b \log{\left (\tan ^{2}{\left (c + d x^{2} \right )} + 1 \right )}}{2 d} - \frac{b^{2} x^{2}}{2} + \frac{b^{2} \tan{\left (c + d x^{2} \right )}}{2 d} & \text{for}\: d \neq 0 \\\frac{x^{2} \left (a + b \tan{\left (c \right )}\right )^{2}}{2} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*(a+b*tan(d*x**2+c))**2,x)

[Out]

Piecewise((a**2*x**2/2 + a*b*log(tan(c + d*x**2)**2 + 1)/(2*d) - b**2*x**2/2 + b**2*tan(c + d*x**2)/(2*d), Ne(
d, 0)), (x**2*(a + b*tan(c))**2/2, True))

________________________________________________________________________________________

Giac [A]  time = 1.22416, size = 72, normalized size = 1.41 \begin{align*} \frac{{\left (d x^{2} + c\right )} a^{2} -{\left (d x^{2} + c - \tan \left (d x^{2} + c\right )\right )} b^{2} - 2 \, a b \log \left ({\left | \cos \left (d x^{2} + c\right ) \right |}\right )}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*(a+b*tan(d*x^2+c))^2,x, algorithm="giac")

[Out]

1/2*((d*x^2 + c)*a^2 - (d*x^2 + c - tan(d*x^2 + c))*b^2 - 2*a*b*log(abs(cos(d*x^2 + c))))/d